
<?php Util::tsRegisterAssetJs('_form.js') ?>
<?php Util::tsRegisterAssetJs('jquery.PrintArea.js') ?>

<div class="form">
    <?php
    /** @var PedidoController $this */
    /** @var Pedido $model */
    /** @var AweActiveForm $form */
    $form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
        'id' => 'pedido-form',
        'enableAjaxValidation' => true,
        'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false,),
        'enableClientValidation' => false,
    ));
    ?>

    <div class="opcionesModal">
        <?php
        $this->widget('bootstrap.widgets.TbButton', array(
//                                'buttonType' => 'submit',
            'type' => 'primary',
            'label' => 'Pedido pendientes',
            'htmlOptions' => array('onclick' => 'javascript:cargarPedidosPendienteModal()')
        ));
        ?>
        <?php
        $this->widget('bootstrap.widgets.TbButton', array(
//                                'buttonType' => 'submit',
            'type' => 'danger',
            'label' => 'Pedidos no pagados',
            'htmlOptions' => array('onclick' => 'javascript:cargarPedidosNoPagados()')
        ));
        ?>
        <?php
        $this->widget('bootstrap.widgets.TbButton', array(
//                                'buttonType' => 'submit',
//            'type' => 'reservados',

            'label' => 'Pedidos reservados',
            'htmlOptions' => array('onclick' => 'javascript:cargarPedidosReservados()',
                'class' => 'btn-reservados',
            )
        ));
        ?>
        <?php
        $this->widget('bootstrap.widgets.TbButton', array(
//                                'buttonType' => 'submit',
            'type' => 'success',
            'label' => 'Tickets ocupados',
            'htmlOptions' => array('onclick' => 'javascript:cargarTicketsOcupados()')
        ));
        ?>

        <ul class="pager">
            <li><a id="mostrarOpcionesModal" href="#">OPCIONES</a></li>
        </ul>
    </div>


    <!--<div class="container-fluid">-->
    <div class="row-fluid">
        <div class="span5" id="contenedorDetalle">
            <div class="" id="headerDetalle"> 
                <h4>  Pedido  </h4>  <span  id='ticketNumero' class="badge">0</span>  <a id="cargarTicket" href="#" class="btn btn-info pull-right"><i class="icon-white icon-tag"></i> Ticket</a>


            </div>
            <div class="detalleMenuCaja">
                <div class="row-fluid">
                    <div class="pull-right ">
                        <?php echo $form->error($model, 'ticket_id'); ?>
                    </div>
                </div>





                <div id="print" style="max-height: 250px; min-height: 250px;overflow: auto;">
                    <div id="imprimirArea">

                        <table id="producto" class="items table table-striped table-bordered table-hover table-advance table-condensed">
                            <thead>
                                <tr>
                                    <th id="orden-producto-grid_c4" class="plusProducto">+</th>
                                    <th id="orden-producto-grid_c0" class="headerTablaProducto">Cant.</th>
                                    <th id="orden-producto-grid_c5" class="minusProducto ">-</th>
                                    <th style="width:80px" id="orden-producto-grid_c1" class="headerTablaProducto">Menu</th>
                                    <th id="orden-producto-grid_c2" class="headerTablaProducto">Precio</th>
                                    <th id="orden-producto-grid_c2" class="headerTablaProducto">Subtotal</th>

                                    <th class="button-column deleteProducto" id="orden-producto-grid_c3">&nbsp;</th>
                                </tr>
                            </thead>
                            <tbody >
                                <!-- CONTENIDO DE LA TABLA -->
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="space20"></div>
                <div class="row-fluid">
                    <hr>
                    <div class="span4 invoice-block pull-right">

                        <hr>
                        <ul class="unstyled amounts" style="text-align: left; padding-right: 5px;">
                            <li><strong>Total :</strong><div class="pull-right">$ <span id="total">0</span></div> </li>
                        </ul>
                    </div>
                </div>
                <hr style="background-color: #f6860e">
                <div class="" style="padding-left: 5%" id="camposPedido">

                    <div class="row-fluid">
                        <div class="span5">
                            <?php // echo $form->checkBoxRow($model, 'estado_pago') ?>
                            <?php echo $form->labelEx($model, 'estado_pago'); ?>
                            <?php
                            $this->widget(
                                    'bootstrap.widgets.TbToggleButton', array(
                                'model' => $model,
                                'disabledLabel' => 'Cancelado',
                                'enabledLabel' => 'Pendiente',
                                'width' => 200,
                                'attribute' => 'estado_pago',
//                                        'htmlOptions' => array('tabindex' => "$cont"),
                                'onChange' => 'js:function($el, status, e){}'
                                    )
                            );
                            ?>

                            <?php echo $form->textAreaRow($model, 'observaciones', array('rows' => 3, 'cols' => 50)) ?>
                        </div>
                        <div class="span4">
                            <div class="controls">
                                <?php echo $form->labelEx($model, 'facturacion'); ?>
                                <?php
                                $this->widget(
                                        'bootstrap.widgets.TbToggleButton', array(
                                    'model' => $model,
                                    'disabledLabel' => 'NO',
                                    'enabledLabel' => 'SI',
                                    'width' => 100,
                                    'attribute' => 'facturacion',
//                                        'htmlOptions' => array('tabindex' => "$cont"),
                                    'onChange' => 'js:function($el, status, e){mostrarNumFactura(status);}'
                                        )
                                );
                                ?>
                                <span class="help-block error" id="Pedido_facturacion_em_"></span>
                            </div>
                            <?php echo $form->error($model, 'numeroFactura'); ?>
                            <?php echo $form->textField($model, 'numeroFactura', array('class' => 'input-medium numeric', 'placeholder' => '# Factura', 'style' => 'display:none')) ?>

                        </div>
                        <div class="span3">
                            <div class="controls">
                                <?php echo $form->labelEx($model, 'reservacion'); ?>
                                <?php
                                $this->widget(
                                        'bootstrap.widgets.TbToggleButton', array(
                                    'model' => $model,
                                    'disabledLabel' => 'NO',
                                    'enabledLabel' => 'SI',
                                    'width' => 100,
                                    'attribute' => 'reservacion',
//                                        'htmlOptions' => array('tabindex' => "$cont"),
//                                    'onChange' => 'js:function($el, status, e){mostrarNumFactura(status);}'
                                        )
                                );
                                ?>
                                <span class="help-block error" id="Pedido_reservacion_em_"></span>
                            </div>
                        </div>
                    </div>
                    <?php echo $form->hiddenField($model, 'ticket_id') ?>
                    <?php echo $form->hiddenField($model, 'persona') ?>
                    <?php // echo $form->dropDownListRow($model, 'ticket_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Ticket::model()->findAll(), 'id', Ticket::representingColumn())) ?>
                    <?php // echo $form->textFieldRow($model, 'fecha') ?>
                    <?php echo $form->hiddenField($model, 'valor_total', array('maxlength' => 10)) ?>

                    <?php // echo $form->dropDownListRow($model, 'estado', array('ABIERTO' => 'ABIERTO', 'CERRADO' => 'CERRADO', 'ANULADO' => 'ANULADO',)) ?>

                    <?php // echo $form->textAreaRow($model, 'observaciones', array('rows' => 3, 'cols' => 50)) ?>
                </div>

                <!--<div class="footerMenus">-->
                <div class="form-actions-float flotante">
                    <?php
                    $this->widget('bootstrap.widgets.TbButton', array(
                        'buttonType' => 'submit',
                        'id' => 'crearPedidoBtn',
                        'type' => 'primary',
                        'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'),
                    ));
                    ?>

                    <?php
                    $this->widget('bootstrap.widgets.TbButton', array(
//                                'buttonType'=>'submit',
                        'type' => 'inverse',
                        'label' => Yii::t('AweCrud.app', 'Cancel'),
                        'htmlOptions' => array('onclick' => 'javascript:history.go(-1)')
                    ));
                    ?>
                </div>


                <!--</div>-->
            </div>
        </div>
        <div class="span7" id="contenedorMenuCaja">
            <div id="loading-fade" class="loading-fade" >

                <div class='loading'><img class='image-loading' src=' <?php echo Yii::app()->baseUrl . "/images/loading1.gif" ?>' /></div>
            </div>
            <div class="" id="headerCaja">
                <a style="display:none" id="regresarSeccion" href="" class="btn btn-default pull-left ">  <div  style="display:inline-block" class=""> <?php echo CHtml::image(Yii::app()->baseUrl . "/images/iconos/back.png") ?> </div> Regresar</a>    <h4>   Menus  </h4>  
                <!--<div class="buscador">-->
                <?php
//             echo $form->dropDownList($model, 'region', CHtml::listData(Region::model()->activos()->findAll(), 'id', Region::representingColumn()), array('empty' => '- Todos -',
                $this->widget(
                        'ext.bootstrap.widgets.TbSelect2', array(
//                'model' => $model,
//                'attribute' => 'region',
                    'name' => 'buscador',
                    'data' => $menus ? array(0 => '-- Seleccione --') + CHtml::listData($menus, 'id', Menu::representingColumn()) : array(null),
                    'options' => array(
//                             'placeholder'=>'MENUS',
//                            'allowClear'=>true,
                    ),
                    'events' => array(
                        'change' => 'js: function(e) { agregarMenu($(this).val());}',
                    ),
                    'htmlOptions' => array(
//                    'multiple' => 'multiple',
                        'style' => 'width:50%',
//                        'class'=>''
                    ),
                        )
                );
                ?>
                <!--</div>-->               

            </div>
            <div id="menuDeCaja" class="menuCaja">



                <div class="metro-nav ">
                    <?php foreach ($secciones as $seccion) : ?>

                        <div class="metro-nav-block nav-block-grey">
                            <a href="<?php echo $seccion->id ?>" data-original-title="" class="secciones">
                                <i class="imagenSeccion"><?php echo CHtml::image(Yii::app()->baseUrl . "/uploads/secciones/$seccion->imagen") ?></i>
                                <div class="info"></div>

                            </a>
                            <div class="status"><?php echo $seccion->nombre ?></div>
                        </div>

                    <?php endforeach; ?>





                </div>

            </div>
            <div class="" id="menus">

            </div>
            <div class="" id="footerCaja">

            </div>

        </div>
    </div>
    <!--</div>-->


    <?php $this->endWidget(); ?>
</div>

